home *** CD-ROM | disk | FTP | other *** search
/ System Booster / System Booster.iso / Texteditors / XDME / include / global.h < prev    next >
Encoding:
C/C++ Source or Header  |  1996-09-27  |  7.5 KB  |  251 lines

  1. /******************************************************************************
  2.  
  3.     MODUL
  4.     global.h
  5.  
  6.     DESCRIPTION
  7.     Defines/structs that mostly all sources depend on.
  8.  
  9. ******************************************************************************/
  10.  
  11. #ifndef GLOBAL_H
  12. #define GLOBAL_H
  13.  
  14. /**************************************
  15.         Includes
  16. **************************************/
  17.  
  18.  
  19. /**************************************
  20.         Globale Variable
  21. **************************************/
  22.  
  23.  
  24. /**************************************
  25.     Defines und Strukturen
  26. **************************************/
  27. typedef LONG            Line;
  28. typedef LONG            Column;
  29.  
  30. typedef struct Node        NODE;
  31. typedef struct MinNode        MNODE;
  32. typedef struct List        LIST;
  33. typedef struct MinList        MLIST;
  34. typedef struct MsgPort        PORT;
  35. typedef struct Window        WIN;
  36. typedef struct Screen        SCREEN;
  37. typedef struct Message        MSG;
  38. typedef struct TextAttr     TA;
  39. typedef struct TextFont     FONT;
  40. typedef struct RastPort     RP;
  41. typedef struct IntuiMessage    IMESS;
  42. typedef struct IntuitionBase    IBASE;
  43. typedef struct Menu        MENU;
  44. typedef struct MenuItem     ITEM;
  45. typedef struct IntuiText    ITEXT;
  46. typedef struct Process        PROC;
  47. typedef UBYTE              * LINE;
  48.  
  49. /* as long as DAS doesn't align after const strings don't define const */
  50. #define CONST        const
  51.  
  52.  
  53. #if 0
  54. New def. for line:
  55.  
  56. typedef struct {
  57.      UWORD   flags;    /* flags        */
  58.      UBYTE   lvl;    /* folding level    */
  59.      VString text;    /* text         */
  60. } LINE;
  61. #endif
  62.  
  63.  
  64. /* Config-Info */
  65. struct Config
  66. {
  67.     Column wwcol;        /*    word wrap column            */
  68.  
  69.     UWORD winx;         /*    save state of non-icon window        */
  70.     UWORD winy;
  71.     UWORD winwidth;
  72.     UWORD winheight;
  73.  
  74.     UWORD iwinx, iwiny;     /*    save state of icon window        */
  75.  
  76.     UWORD aslleft;        /* pos of FileReq */
  77.     UWORD asltop;
  78.     UWORD aslwidth;
  79.     UWORD aslheight;
  80.  
  81.     Column tabstop;        /* size of tabs */
  82.     Column margin;
  83.  
  84.     UBYTE fgpen;        /* Pens */
  85.     UBYTE bgpen;
  86.     UBYTE hgpen;
  87.     UBYTE tpen;
  88.     UBYTE bbpen;
  89.  
  90.     ULONG insertmode  : 1;  /* insert or overwrite */
  91.     ULONG ignorecase  : 1;  /* should SEARCH ignore the case ? */
  92.     ULONG wordwrap    : 1;  /* do wordwrap ? */
  93.     ULONG autosplit   : 1;  /* Split line automatically ? */
  94.     ULONG autoindent  : 1;  /* Autoindent cursor after <RETURN> ? */
  95.     ULONG autounblock : 1;  /* Automatic Unblock on new BLOCK-command ? */
  96. };
  97.  
  98.  
  99. struct GlobalFlags
  100. {
  101.     ULONG debug : 1;        /* Do debugging */
  102.     ULONG NoRequest : 1;    /* PATCH_NULL: disable requestors        */
  103.     ULONG Showtitle : 1;    /* Used by untitle to disable some title calls    */
  104.     ULONG Msgchk : 1;        /* Force message queue check for break        */
  105.     ULONG Windowcycling : 1;    /* PATCH_NULL : SELECT last SELECT next == SELECT first */
  106.     ULONG ActivateToFront : 1;    /* PATCH_NULL : SELECTed windows are moved to front    */
  107.     ULONG SourceBreaks : 1;    /* PATCH_NULL : errors in source abort the read     */
  108.     ULONG Savetabs : 1;     /* SaveTabs mode?                */
  109.  
  110.     ULONG SimpleTabs : 1;    /* PATCH_NULL [25 Jan 1993] : SaveTabs mode only until firstnb ? */
  111.     ULONG memoryfail : 1;    /* out of memory flag                */
  112.     ULONG Comlinemode : 1;    /* Is commandline active ?            */
  113.     ULONG Abortcommand : 1;    /* Should loop-command (while/repeat) abort ?   */
  114.     ULONG global_search : 1;    /* Do a global search ?             */
  115.     ULONG Quitflag : 1;     /* Should DME close actual window ?        */
  116.     ULONG QuitAll : 1;        /* Should DME quit ?                */
  117.     ULONG Overide : 1;        /* Quit even if file was modified        */
  118.  
  119.     ULONG Wdisable : 1;     /* Disable icon save                */
  120.     ULONG MForceTitle : 1;    /* Force refresh of title            */
  121.     ULONG FollowCursor : 1;    /* Make sure cursor is visible            */
  122. };
  123.  
  124.  
  125. typedef struct _ED
  126. {
  127.     NODE        node;    /* for list */
  128.     WIN       * win;    /* actual window */
  129.     struct Gadget * propgad;    /* Pointer to our PropGadget */
  130.     FONT      * font;    /* actual font! */
  131.     Line        topline;
  132.     Column        topcolumn;    /* top left edge of window in the text */
  133.     Line        line;
  134.     Column        column;    /* actual cursor position */
  135.     long        lines,
  136.             maxlines;    /* number of text-lines we use and how much we
  137.                    have at most */
  138.     LINE      * list;    /* list of text-lines */
  139.     UBYTE        name[64];
  140.     UBYTE        wtitle[130];
  141.     ULONG        modified : 1;   /* is text modified ? */
  142.     ULONG        iconmode : 1;   /* window in icon mode */
  143.     ULONG        viewmode : 1;   /* PATCH_NULL: disable changes to text */
  144.     BPTR        dirlock;    /* directory lock */
  145.  
  146.     APTR        textvars;        /* PATCH_NULL: list of localized vars  */
  147.     char        textflags[4];   /* PATCH_NULL: field of local flags    */
  148.     APTR        package;        /* PATCH_NULL: ptr to current Package  */
  149. /* --- I have decided not to use Packages but multiple Menues and Keytables */
  150.     APTR        menustrip;        /* PATCH_NULL: ptr to current MenuStrip */
  151.     APTR        keytable;        /* PATCH_NULL: ptr to current KeyTable  */
  152. /*    APTR          package;          / * PATCH_NULL: ptr to current Package   */
  153.  
  154.     /*
  155.      *    CONFIG INFORMATION
  156.      */
  157.     struct Config config;
  158.  
  159. } ED;
  160.  
  161.  
  162. #define beginconfig        config
  163. #define CONFIG_SIZE        (sizeof(struct Config))
  164. #define CONFIG_VERSION        "XDMECNFG0003"
  165. #define XDME_CONFIG        "S:XDME.prefs"
  166.  
  167.  
  168. /* Define Colors */
  169. #define TEXT_FPEN   Ep->config.fgpen
  170. #define TEXT_BPEN   Ep->config.bgpen
  171. #define BLOCK_FPEN  Ep->config.hgpen
  172. #define BLOCK_BPEN  Ep->config.bbpen
  173. #define TITLE_FPEN  TEXT_FPEN
  174. #define TITLE_BPEN  Ep->config.tpen
  175. #define TEXT_MASK   (TEXT_FPEN | TEXT_BPEN)
  176. #define BLOCK_MASK  (TEXT_FPEN | TEXT_BPEN | BLOCK_FPEN | BLOCK_BPEN)
  177.  
  178.  
  179. /* Block-Types
  180.     note:   BSxxx is invalid if BSline < 0,
  181.         BExxx is invalid if BEline < 0
  182.     If BlockType == BT_NONE, one must not check any other values.
  183. */
  184. #define BT_NONE     0        /* No current block */
  185. #define BT_LINE     1        /* Block is full-line */
  186. #define BT_NORMAL   2        /* Block starts at BScolumn/BSline and ends at
  187.                    BEcolumn/BEline */
  188. #define BT_VERTICAL 3        /* Block is a rectangle from BScolumn/BSline to
  189.                    BEcolumn/BEline */
  190. /*
  191.     Current state of block (temporary)
  192. */
  193. #define BF_START    64        /* Move BSxxx instead of BExxx */
  194. #define BF_ACTIVE   128     /* Block is currently beeing marked (values of
  195.                    block may change) */
  196.  
  197. /* Result of lineflags(line): */
  198. #define LINE_ABOVE    1    /* line < Ep->Topline */
  199. #define LINE_VISIBLE    2    /* line >= Ep->Topline && line < Ep->Topline + Rows */
  200. #define LINE_BELOW    4    /* line >= Ep->Topline + Rows */
  201.  
  202. /* Where in the block am I actually ?
  203.  
  204.    BP_INSIDE+BP_START    - Inside 1. line of block
  205.    BP_START        - In the same line in which block starts but not inside
  206.               block.
  207.    BP_START+END+INSIDE    - I am in the only line the block has.
  208.    BP_START+BP_END    - dito but not INSIDE the block
  209. */
  210. #define BP_OUTSIDE        0
  211. #define BP_INSIDE        1        /* Inside block (anywhere) */
  212. #define BP_START        2        /* line == BSline */
  213. #define BP_END            4        /* line == BEline */
  214.  
  215.  
  216. typedef struct
  217. {
  218.     ED     * ep;            /* the editor the block is in */
  219.     UWORD  type;        /* BT_xxx */
  220.     UWORD  flags;
  221.     Line   start_line;        /* start- and endline */
  222.     Line   end_line;
  223.     Column start_column;    /* start- and endcolumn */
  224.     Column end_column;
  225. } Block;
  226.  
  227.  
  228. struct TextMarker
  229. {
  230.     ED     * ep;            /* The editor the marker is for */
  231.     Line   line;        /* line and column */
  232.     Column column;
  233. };
  234.  
  235.  
  236. /* Macros */
  237.  
  238. #define redraw_textline(line)  redraw_textlineseg(line,Ep->topcolumn,Ep->topcolumn+Columns)
  239.  
  240.  
  241. /**************************************
  242.            Prototypes
  243. **************************************/
  244.  
  245.  
  246. #endif /* GLOBAL_H */
  247.  
  248. /******************************************************************************
  249. *****  ENDE global.h
  250. ******************************************************************************/
  251.